'use strict'
//编写高阶函数
function add(x,y,z){
    return z(x)+z(y);
}
var a =add(3,4,Math.abs)
console.log('编写高阶函数测试：'+a);

//map
function getnew(x){
    return x*x
}
var arr =[22,55,3,45,164]
var newarr =arr.map(getnew)
console.log('原数组：'+arr);
console.log('map测试：'+newarr);

//reduce
function getlike(x,y){
    return x*10+y
}
var arr =[4,5,6,7,8]
var newarr =arr.reduce(getlike)
console.log('原数组：'+arr);
console.log('reduce测试：'+newarr);

//filter基偶
function getdream(x){
    return x%2 != 0
}
var arr =[12,99,54,68,87,77,77777,654,123,44]
var newarr =arr.filter(getdream)
console.log('原数组：'+arr);
console.log('filter基偶测试：'+newarr);

//filter空格
function gettrue(x){
    return x && x.trim();
}
var arr =['','正确','错误','   ','空间']
var newarr = arr.filter(gettrue)
console.log('原数组：'+arr);
console.log('filter空格测试：'+newarr);

console.log('if you like this world ,you will think every will be better!');
console.log('none');
console.log('you need something to get your dream');